package com.example.javaagent.instrumentation.httpclinet;

import io.opentelemetry.context.propagation.TextMapSetter;
import java.net.http.HttpHeaders;
import java.net.http.HttpRequest;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;

public class HttpSetter implements TextMapSetter<HttpRequest> {


  public HttpHeaders inject(HttpHeaders original, String xid) {
    Map<String, List<String>> headerMap = new HashMap<>(original.map());
    headerMap.put("x-request-id", Collections.singletonList(xid));
    return HttpHeaders.of(headerMap, (s, s2) -> true);
  }


  @Override
  public void set(@Nullable HttpRequest carrier, String key, String value) {

  }
}
